<% if @reply.errors.blank? %>
  <% if @reply.upvote? %>
    Turbolinks.visit(location.href);
  <% else %>
    <% @page = 1 %>
    if($("#replies").length == 0){
      Turbolinks.visit(location.href);
    }
    else {
      var current_floor = parseInt($("#replies").data("last-floor")) + 1;
      $("#replies .items").append('<%= j(render("reply", reply: @reply, reply_counter: @topic.replies_count - 1, display_edit: true)) %>')
        .find(".total b").text('<%= @topic.replies_count %>');
      $("#replies .items .reply:last .reply-floor").text(current_floor + " 楼");
      $("#replies").data("last-floor", current_floor);
      $("#replies .reply a.edit:last").css("display", "inline-block");
      _topicView.replyCallback(1, '<%= j(@msg) %>');
    }
  <% end %>
<% else %>
  _topicView.replyCallback(0, '<%= j(@msg) %>');
<% end %>
